<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<jsp:useBean id="con000" class="com.tpc.control.bean.Con000"
	scope="session" />
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
if (con000.getLogon() == null || !con000.getLogon())
	response.sendRedirect(basePath+"/con000/con000.faces");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>CON-101: Order Reservation[Create/Edit]</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="./css/custom.css">
		<link rel="stylesheet" type="text/css" href="./css/template01.css">
	</head>

	<body>
		<div id="wrapper">
    	
		<f:view>
			<f:loadBundle var="bundle"
				basename="com.tpc.control.message.ResourceBundle" />
			<div id="header">
				<p><h:outputText value="#{bundle.project_name}"/></p>		 	   
			</div>
	        <div id="navigation">
	        	<h:outputText value="#{bundle.con101}" styleClass="header2"/>	 
			</div>
			<div id="content">
			<h:form id="con101Form">
				<a4j:outputPanel id="reserveHeaderPanel">
					<a4j:outputPanel id="messagePanel">
						<h:messages errorClass="errorMessages" infoClass="infoMessages"></h:messages>
					</a4j:outputPanel>
					<h:panelGrid columns="4" styleClass="normal">
						<h:outputText value="#{bundle.reserve_no}" styleClass="headerSubject"/>
						<h:outputText value="#{con100.reserve.reserveNo}"></h:outputText>
						<h:outputText value=""/>
						<h:outputText value=""/>
						<h:outputText value="#{bundle.customer}" styleClass="headerSubject"/>
						<h:inputText value="#{con100.reserve.customer}" maxlength="10" size="10" disabled="#{con100.changed}">
							<a4j:support id="onchangeCustomer" event="onchange" reRender="reserveMessagePanel,reserveHeaderPanel" actionListener="#{con100.onchangeCustomer}"/>
						</h:inputText>
						<h:outputText value="#{bundle.customerName}" styleClass="headerSubject"/>
						<h:outputText value="#{con100.reserve.customerName}"></h:outputText>
						<h:outputText value="#{bundle.createDate}" styleClass="headerSubject"/>
						<h:outputText value="#{con100.reserve.createDate}" >
							<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
						</h:outputText>
						<h:outputText value="#{bundle.createBy}" styleClass="headerSubject"/>
						<h:outputText value="#{con100.reserve.createBy}"></h:outputText>
					</h:panelGrid>
				</a4j:outputPanel>
				<a4j:commandButton id="insertLine" oncomplete="#{rich:component('insertReserveLinePanel')}.show()" image="/images/addRow.png" actionListener="#{con100.insertReserveLineOpen}" reRender="insertReserveLinePanel"/>
				<rich:scrollableDataTable var="item" value="#{con100.reserveItems}" width="800px" height="110px" id="reserveItemTable" selection="#{con100.selection}">
					<rich:column sortable="false" width="40px">
						<f:facet name="header">
							<h:outputText value="#{bundle.reserve_line_no}"></h:outputText>
						</f:facet>
						<h:outputText value="#{item.id.reserveLine}"/>
					</rich:column>
					<rich:column sortable="false">
						<f:facet name="header">
							<h:outputText value="#{bundle.material_no}"></h:outputText>
						</f:facet>
						<h:outputText value="#{item.materialNo}" />
					</rich:column>
					<rich:column sortable="false">
						<f:facet name="header">
							<h:outputText value="#{bundle.material_design}"></h:outputText>
						</f:facet>
						<h:outputText value="#{item.materialDesign}" />
					</rich:column>
					<rich:column sortable="false" width="50px" styleClass="textCenter">
						<f:facet name="header">
							<h:outputText value="#{bundle.division}"></h:outputText>
						</f:facet>
						<h:outputText value="#{item.division}" />
					</rich:column>
					<rich:column sortable="false" styleClass="textRight">
						<f:facet name="header">
							<h:outputText value="#{bundle.reserve_qty}"></h:outputText>
						</f:facet>
						<h:outputText value="#{item.reserveQty}">
							<f:convertNumber pattern="#,##0.00"/>
						</h:outputText>
					</rich:column>
					<rich:column sortable="false" width="50px" styleClass="textCenter">
						<f:facet name="header">
							<h:outputText value="#{bundle.uom}"></h:outputText>
						</f:facet>
						<h:outputText value="#{item.uom}" />
					</rich:column>
					<rich:column sortable="false" styleClass="textCenter">
						<f:facet name="header">
							<h:outputText value="#{bundle.delivery_date}"></h:outputText>
						</f:facet>
						<h:outputText value="#{item.deliveryDate}">
							<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
						</h:outputText>
					</rich:column>
					<rich:column sortable="false">
						<f:facet name="header">
							<h:outputText value="#{bundle.status}"></h:outputText>
						</f:facet>
						<h:selectOneMenu value="#{item.status}" disabled="true">
							<f:selectItems value="#{con100.statusList}"/>
						</h:selectOneMenu>
					</rich:column>
					<a4j:support id="take_reserveline" reRender="reserveLinePanel" event="onselectionchange" actionListener="#{con100.selectReserveLineEvent}"/>
				</rich:scrollableDataTable>
				<a4j:outputPanel id="reserveLinePanel">
					<h:panelGrid columns="8" styleClass="normal">
						<h:outputText value="#{bundle.reserve_line_no}" styleClass="headerSubject"/>
						<h:outputText value="#{con100.selectItem.id.reserveLine}"></h:outputText>
						<h:panelGroup>
							<h:outputText value="#{bundle.division}" styleClass="headerSubject"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:selectOneMenu value="#{con100.selectItem.division}" disabled="#{!con100.editLine}">
							<f:selectItems value="#{con100.divisionList}"/>
							<a4j:support id="onchangeDivision" event="onchange" reRender="reserveItemTable" actionListener="#{con100.onchangeReserveItem}"/>
						</h:selectOneMenu>
						<h:outputText value="#{bundle.material_no}" styleClass="headerSubject"/>
						<h:inputText value="#{con100.selectItem.materialNo}" maxlength="18" size="18" disabled="#{!con100.editLine}">
							<a4j:support id="onchangeMaterialNo" event="onchange" reRender="reserveItemTable" actionListener="#{con100.onchangeReserveItem}"/>
						</h:inputText>
						<h:panelGroup>
							<h:outputText value="#{bundle.material_design}" styleClass="headerSubject"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:inputText value="#{con100.selectItem.materialDesign}" maxlength="40" size="20" disabled="#{!con100.editLine}">
							<a4j:support id="onchangeMaterialDesign" event="onchange" reRender="reserveItemTable" actionListener="#{con100.onchangeReserveItem}"/>
						</h:inputText>
						
						<h:panelGroup>
							<h:outputText value="#{bundle.reserve_qty}" styleClass="headerSubject"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:inputText value="#{con100.selectItem.reserveQty}" size="10" maxlength="20" disabled="#{!con100.editLine}">
							<a4j:support id="onchangeReserveQty" event="onchange" reRender="reserveItemTable" actionListener="#{con100.onchangeReserveItem}"/>
						</h:inputText>
						<h:panelGroup>
							<h:outputText value="#{bundle.uom}" styleClass="headerSubject"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:selectOneMenu value="#{con100.selectItem.uom}" disabled="#{!con100.editLine}">
							<f:selectItems value="#{con100.uomList}"/>
							<a4j:support id="onchangeUOM" event="onchange" reRender="reserveItemTable" actionListener="#{con100.onchangeReserveItem}"/>
						</h:selectOneMenu>
						<h:panelGroup>
							<h:outputText value="#{bundle.delivery_date}" styleClass="headerSubject"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<rich:calendar value="#{con100.selectItem.deliveryDate}" datePattern="dd.MM.yyyy" locale="th_US" disabled="#{!con100.editLine}">
							<a4j:support id="onchangeDeliveryDate" event="onchanged" reRender="reserveItemTable" actionListener="#{con100.onchangeReserveItem}"/>
						</rich:calendar>
						<h:panelGroup>
							<h:outputText value="#{bundle.status}" styleClass="headerSubject"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:selectOneMenu value="#{con100.selectItem.status}" disabled="#{!con100.editLine}">
							<f:selectItems value="#{con100.statusList}"/>
							<a4j:support id="onchangeStatus" event="onchange" reRender="reserveItemTable" actionListener="#{con100.onchangeReserveItem}"/>
						</h:selectOneMenu>
					</h:panelGrid>
					
					<rich:tabPanel switchType="ajax" id="reserveTabPanel">
				        <rich:tab label="#{bundle.tab1}">
				        	<a4j:include viewId="/con100/con101_1.jsp"></a4j:include>
				        </rich:tab>
				        <rich:tab label="#{bundle.tab2}">
				        	<a4j:include viewId="/con100/con101_2.jsp"></a4j:include>
				        </rich:tab>
				        <rich:tab label="#{bundle.tab3}">
				        	<a4j:include viewId="/con100/con101_3.jsp"></a4j:include>
				        </rich:tab>
				        <rich:tab label="#{bundle.tab4}">
				        	<a4j:include viewId="/con100/con101_4.jsp"></a4j:include>
				        </rich:tab>
				        <rich:tab label="#{bundle.tab5}">
				        	<a4j:include viewId="/con100/con101_5.jsp"></a4j:include>
				        </rich:tab>
				    </rich:tabPanel>
				</a4j:outputPanel>
				<h:commandButton value="#{bundle.save}" actionListener="#{con100.save}"></h:commandButton>
				<h:commandButton value="#{bundle.cancel}" action="#{con100.cancel}"></h:commandButton>
			</h:form>
			<rich:modalPanel id="insertReserveLinePanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="#{bundle.insert_reserve_line}" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeInsertReserveLinelink" />
						<rich:componentControl for="insertReserveLinePanel"
							attachTo="closeInsertReserveLinelink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101Form_Insert">
					<h:panelGrid columns="4" styleClass="normal">
						<h:outputText value="#{bundle.material_no}"/>
						<h:inputText value="#{con100.insertItem.materialNo}" size="18" maxlength="18"/>
						<h:panelGroup>
							<h:outputText value="#{bundle.material_design}"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:inputText value="#{con100.insertItem.materialDesign}" maxlength="40" size="20"/>
						<h:panelGroup>
							<h:outputText value="#{bundle.division}"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:selectOneMenu value="#{con100.insertItem.division}" id="inputDivision">
							<f:selectItems value="#{con100.divisionList}"/>
						</h:selectOneMenu>
						<h:panelGroup>
							<h:outputText value="#{bundle.reserve_qty}"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:inputText value="#{con100.insertItem.reserveQty}"/>
						<h:panelGroup>
							<h:outputText value="#{bundle.uom}"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:selectOneMenu value="#{con100.insertItem.uom}">
							<f:selectItems value="#{con100.uomList}"/>
						</h:selectOneMenu>
						<h:panelGroup>
							<h:outputText value="#{bundle.delivery_date}"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<rich:calendar value="#{con100.insertItem.deliveryDate}" datePattern="dd.MM.yyyy" locale="th_US" />
						<h:panelGroup>
							<h:outputText value="#{bundle.status}"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:selectOneMenu value="#{con100.insertItem.status}">
							<f:selectItems value="#{con100.statusList}"/>
						</h:selectOneMenu>
					</h:panelGrid>
					<a4j:commandButton id="insertReservreLineButton" value="Insert" reRender="reserveItemTable" 
					onclick="javascript:Richfaces.hideModalPanel('insertReserveLinePanel');" 
							action="#{con100.insertReserveLineSave}">
					</a4j:commandButton>
				</h:form>
			</rich:modalPanel>
			
			<rich:modalPanel id="insertReserveLineLabPanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="#{bundle.insert_reserve_line_lab}" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeInsertReserveLineLablink" />
						<rich:componentControl for="insertReserveLineLabPanel"
							attachTo="closeInsertReserveLineLablink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101_1Form_Insert">			
					<h:panelGrid columns="2" styleClass="normal">
						<h:outputText value="#{bundle.color_tpc}"/>
						<h:inputText value="#{con100.insertLabItem.colorTpc}" size="10" maxlength="10"/>
						<h:outputText value="#{bundle.color_customer}"/>
						<h:inputText value="#{con100.insertLabItem.colorCustomer}" size="10" maxlength="10"/>
						<h:outputText value="#{bundle.detail}"/>
						<h:inputText value="#{con100.insertLabItem.detail}" size="16" maxlength="16"/>
						<h:outputText value="#{bundle.no_lab}"/>
						<h:inputText value="#{con100.insertLabItem.noLab}" size="10" maxlength="10"/>
						<h:outputText value="#{bundle.standard_date}"/>
						<rich:calendar value="#{con100.insertLabItem.standardDate}" datePattern="dd.MM.yyyy" locale="th_US" />
						<h:outputText value="#{bundle.confirm_lab_actual}"/>
						<rich:calendar value="#{con100.insertLabItem.confirmLabActual}" datePattern="dd.MM.yyyy" locale="th_US" />
					</h:panelGrid>
					<a4j:commandButton id="insertReservreLineLabButton" value="Insert" reRender="reserveItemLabTable,insertReserveLineLabPanel" 
					onclick="javascript:Richfaces.hideModalPanel('insertReserveLineLabPanel');" 
							action="#{con100.insertReserveLineLabSave}">
					</a4j:commandButton>
				</h:form>
			</rich:modalPanel>
			
			<rich:modalPanel id="editReserveLineLabPanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="Edit Lab Line" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeEditReserveLineLablink" />
						<rich:componentControl for="editReserveLineLabPanel"
							attachTo="closeEditReserveLineLablink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101_1Form_Edit">			
					<a4j:outputPanel id="editReserveLineLabOutputPanel">
						<h:panelGrid columns="2" styleClass="normal">
							<h:outputText value="#{bundle.reserve_lab_no}"/>
							<h:outputText value="#{con100.selectLabItem.id.reserveLabNo}"/>
							<h:outputText value="#{bundle.color_tpc}"/>
							<h:inputText value="#{con100.selectLabItem.colorTpc}" size="10" maxlength="10"/>
							<h:outputText value="#{bundle.color_customer}"/>
							<h:inputText value="#{con100.selectLabItem.colorCustomer}" size="10" maxlength="10"/>
							<h:outputText value="#{bundle.detail}"/>
							<h:inputText value="#{con100.selectLabItem.detail}" size="16" maxlength="16"/>
							<h:outputText value="#{bundle.no_lab}"/>
							<h:inputText value="#{con100.selectLabItem.noLab}" size="10" maxlength="10"/>
							<h:outputText value="#{bundle.standard_date}"/>
							<rich:calendar value="#{con100.selectLabItem.standardDate}" datePattern="dd.MM.yyyy" locale="th_US" />
							<h:outputText value="#{bundle.confirm_lab_plan}"/>
							<rich:calendar value="#{con100.selectLabItem.confirmLabPlan}" datePattern="dd.MM.yyyy" locale="th_US" />
							<h:outputText value="#{bundle.confirm_lab_actual}"/>
							<rich:calendar value="#{con100.selectLabItem.confirmLabActual}" datePattern="dd.MM.yyyy" locale="th_US" />
						</h:panelGrid>
					</a4j:outputPanel>
					<a4j:commandButton id="editReservreLineLabButton" value="Save" reRender="reserveItemLabTable,editReserveLineLabPanel" 
					onclick="javascript:Richfaces.hideModalPanel('editReserveLineLabPanel');" />
				</h:form>
			</rich:modalPanel>
			
			<rich:modalPanel id="insertReserveLineLabAnswerPanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="Lab Answer" />
				</f:facet>
				<h:form id="con101_11Form_Insert">			
					<h:outputText value="#{bundle.reserve_lab_no}"/>
					<h:outputText value="#{con100.selectLabItem.id.reserveLabNo}"/>
					<a4j:commandButton id="insertLabAnswerLine" image="/images/add.gif" actionListener="#{con100.insertReserveLabAnswerLine}" disabled="#{!con100.editLab}" reRender="reserveItemLabAnswerTable"/>
					<rich:dataTable var="labAnswerItem" value="#{con100.labAnswerItems}" id="reserveItemLabAnswerTable">
						<rich:column width="40px">
							<f:facet name="header">
								<h:outputText value="#{bundle.no}"></h:outputText>
							</f:facet>
							<h:outputText value="#{labAnswerItem.id.reserveLabAnswerNo}"></h:outputText>
						</rich:column>
						<rich:column width="200px">
							<f:facet name="header">
								<h:outputText value="#{bundle.lab_date}"></h:outputText>
							</f:facet>
							<rich:calendar value="#{labAnswerItem.reserveLabDate}" datePattern="dd.MM.yyyy" locale="th_US"/>
						</rich:column>
						<rich:column width="180px">
							<f:facet name="header">
								<h:outputText value="#{bundle.remark}"></h:outputText>
							</f:facet>
							<h:inputText value="#{labAnswerItem.remark}"></h:inputText>
						</rich:column>
					</rich:dataTable>
					<a4j:commandButton id="labAnswerOKButton" value="OK" onclick="javascript:Richfaces.hideModalPanel('insertReserveLineLabAnswerPanel');" actionListener="#{con100.insertReserveLineLabAnswerOk}" reRender="reserveItemLabTable"/>
					<a4j:commandButton id="labAnswerCancelButton" value="Cancel" onclick="javascript:Richfaces.hideModalPanel('insertReserveLineLabAnswerPanel');" actionListener="#{con100.insertReserveLineLabAnswerCancel}"/>
				</h:form>
			</rich:modalPanel>
			
			<rich:modalPanel id="insertReserveLineGreigePanel" autosized="true" width="300" height="200">
				<f:facet name="header">
					<h:outputText value="#{bundle.insert_reserve_line_greige}" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeInsertReserveLineGreigelink" />
						<rich:componentControl for="insertReserveLineGreigePanel"
							attachTo="closeInsertReserveLineGreigelink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101_3Form_Insert">			
					<h:panelGrid columns="2" styleClass="normal">
						<h:panelGroup>
							<h:outputText value="#{bundle.production_no}"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:inputText value="#{con100.insertGreigeItem.commonData.id.productionNo}" size="12" maxlength="12"/>
						<h:outputText value="#{bundle.remark}"/>
						<h:inputText value="#{con100.insertGreigeItem.remark}"/>
					</h:panelGrid>
					<a4j:commandButton id="insertReservreLineGreigeButton" value="Insert" reRender="reserveItemGreigeTable,reserveItemSaleTable,insertReserveLineGreigePanel,messagePanel" 
					onclick="javascript:Richfaces.hideModalPanel('insertReserveLineGreigePanel');" 
							action="#{con100.insertReserveLineGreigeSave}">
					</a4j:commandButton>
				</h:form>	
			</rich:modalPanel>
			
			<rich:modalPanel id="editReserveLineGreigePanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="Edit Greige Line" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeEditReserveLineGreigelink" />
						<rich:componentControl for="editReserveLineGreigePanel"
							attachTo="closeEditReserveLineGreigelink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101_3Form_Edit">			
					<a4j:outputPanel id="editReserveLineGreigeOutputPanel">
						<h:panelGrid columns="2" styleClass="normal">
							<h:outputText value="#{bundle.production_no}"/>
							<h:outputText value="#{con100.selectGreigeItem.commonData.id.productionNo}"></h:outputText>
							<h:outputText value="#{bundle.material_greige}"/>
							<h:outputText value="#{con100.selectGreigeItem.commonData.material}"></h:outputText>
							<h:outputText value="#{bundle.qty_prod}" />
							<h:outputText value="#{con100.selectGreigeItem.commonData.quantity}">
								<f:convertNumber pattern="#,##0.00"/>
							</h:outputText>
							<h:outputText value="#{bundle.uom}" />
							<h:outputText value="#{con100.selectGreigeItem.commonData.uom}"></h:outputText>
							<h:outputText value="#{bundle.prod_start_date}" />
							<h:outputText value="#{con100.selectGreigeItem.commonData.startDate}">
								<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
							</h:outputText>
							<h:outputText value="#{bundle.last_posting_date}" />
							<h:outputText value="#{con100.selectGreigeItem.commonData.lastPostingDate}">
								<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
							</h:outputText>
							<h:outputText value="#{bundle.remark}" />
							<h:inputText value="#{con100.selectGreigeItem.remark}"/>
						</h:panelGrid>
					</a4j:outputPanel>
					<a4j:commandButton id="editReservreLineGreigeButton" value="Save" reRender="reserveItemGreigeTable,editReserveLineGreigePanel" 
					onclick="javascript:Richfaces.hideModalPanel('editReserveLineGreigePanel');"/>
				</h:form>
			</rich:modalPanel>
			
			<rich:modalPanel id="deleteReserveLineGreigePanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="Confirm Delete Greige Line" />
				</f:facet>
				<h:form id="con101_3Form_Delete">			
					<a4j:outputPanel id="deleteReserveLineGreigeOutputPanel">
						<h:panelGrid columns="1" styleClass="textCenter">
							<h:outputText value="Do you want to delete #{con100.selectGreigeItem.commonData.id.productionNo} ?" styleClass="normal"/>
							<h:panelGroup>
								<a4j:commandButton id="deleteGreigeButtonOk" value="Delete" reRender="reserveItemGreigeTable,reserveItemSaleTable,messagePanel" 
									onclick="javascript:Richfaces.hideModalPanel('deleteReserveLineGreigePanel');" actionListener="#{con100.deleteReserveItemGreige}"/>
								<a4j:commandButton id="deleteGreigeButtonCancel" value="Cancel" reRender="reserveItemGreigeTable" 
									onclick="javascript:Richfaces.hideModalPanel('deleteReserveLineGreigePanel');"/>
							</h:panelGroup>
						</h:panelGrid>
					</a4j:outputPanel>
				</h:form>
			</rich:modalPanel>
		
			<rich:modalPanel id="insertReserveLineSalePanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="#{bundle.insert_reserve_line_sale}" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeInsertReserveLineSalelink" />
						<rich:componentControl for="insertReserveLineSalePanel"
							attachTo="closeInsertReserveLineSalelink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101_4Form_Insert">			
					<h:panelGrid columns="4" styleClass="normal">
						<h:panelGroup>
							<h:outputText value="Sale Order"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:inputText value="#{con100.insertSaleItem.id.saleOrder}" size="10" maxlength="10"/>
						<h:panelGroup>
							<h:outputText value="Sale Item"/>
							<h:outputText value="*" styleClass="require"/>
						</h:panelGroup>
						<h:inputText value="#{con100.insertSaleItem.id.saleItem}" maxlength="6" size="6"/>						
						<h:outputText value="#{bundle.remark}"/>
						<h:inputText value="#{con100.insertSaleItem.remark}"/>
					</h:panelGrid>
					<a4j:commandButton id="insertReservreLineSaleButton" value="Insert" reRender="reserveItemSaleTable,reserveItemDyeTable,insertReserveLineSalePanel" 
					onclick="javascript:Richfaces.hideModalPanel('insertReserveLineSalePanel');" 
							action="#{con100.insertReserveLineSaleSave}">
					</a4j:commandButton>
				</h:form>			
			</rich:modalPanel>
			
			<rich:modalPanel id="editReserveLineSalePanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="Edit Sale Line" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeEditReserveLineSalelink" />
						<rich:componentControl for="editReserveLineSalePanel"
							attachTo="closeEditReserveLineSalelink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101_4Form_Edit">			
					<a4j:outputPanel id="editReserveLineSaleOutputPanel">
						<h:panelGrid columns="2" styleClass="normal">
							<h:outputText value="Sale Order" />
							<h:outputText value="#{con100.selectSaleItem.reserveItemSale.id.saleOrder}"></h:outputText>
							<h:outputText value="Sale Item" />
							<h:outputText value="#{con100.selectSaleItem.reserveItemSale.id.saleItem}"></h:outputText>
							<h:outputText value="#{bundle.material}" />
							<h:outputText value="#{con100.selectSaleItem.reserveItemSale.saleData.material}"></h:outputText>
							<h:outputText value="#{bundle.qty_order}" />
							<h:outputText value="#{con100.selectSaleItem.reserveItemSale.saleData.quantity}">
								<f:convertNumber pattern="#,##0.00"/>
							</h:outputText>
							<h:outputText value="#{bundle.uom}" />
							<h:outputText value="#{con100.selectSaleItem.reserveItemSale.saleData.uom}"></h:outputText>
							<h:outputText value="Due Date" />
							<h:outputText value="#{con100.selectSaleItem.reserveItemSale.saleData.dueDate}">
								<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
							</h:outputText>
							<h:outputText value="Production greige" />
							<h:selectOneMenu value="#{con100.selectSaleItem.commonDataId.productionNo}" id="saleProduct">
								<f:selectItems value="#{con100.productionList}"/>
							</h:selectOneMenu>
							<h:outputText value="#{bundle.remark}" />
							<h:inputText value="#{con100.selectSaleItem.reserveItemSale.remark}"/>
						</h:panelGrid>
					</a4j:outputPanel>
					<a4j:commandButton id="editReservreLineSaleButton" value="Save" reRender="reserveItemSaleTable,editReserveLineSalePanel" 
					onclick="javascript:Richfaces.hideModalPanel('editReserveLineSalePanel');" actionListener="#{con100.editReservreLineSaleSave}"/>
				</h:form>
			</rich:modalPanel>
			
			<rich:modalPanel id="editReserveLineDyePanel" autosized="true">
				<f:facet name="header">
					<h:outputText value="Edit Dye Line" />
				</f:facet>
				<f:facet name="controls">
					<h:panelGroup>
						<h:graphicImage value="/images/modal/close.png"
							id="closeEditReserveLineDyelink" />
						<rich:componentControl for="editReserveLineDyePanel"
							attachTo="closeEditReserveLineDyelink" operation="hide" event="onclick" />
					</h:panelGroup>
				</f:facet>
				<h:form id="con101_5Form_Edit">			
					<a4j:outputPanel id="editReserveLineDyeOutputPanel">
						<h:panelGrid columns="2" styleClass="normal">
							<h:outputText value="#{bundle.production_no}"/>
							<h:outputText value="#{con100.selectDyeItem.id.productionNo}"></h:outputText>
							<h:outputText value="#{bundle.material}" />
							<h:outputText value="#{con100.selectDyeItem.material}"></h:outputText>
							<h:outputText value="#{bundle.qty_prod}" />
							<h:outputText value="#{con100.selectDyeItem.quantity}">
								<f:convertNumber pattern="#,##0.000"/>
							</h:outputText>
							<h:outputText value="#{bundle.uom}"/>
							<h:outputText value="#{con100.selectDyeItem.uom}"></h:outputText>
							<h:outputText value="#{bundle.prod_start_date}"/>
							<h:outputText value="#{con100.selectDyeItem.startDate}">
								<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
							</h:outputText>
							<h:outputText value="#{bundle.last_posting_date}" style="white-space : nowrap"></h:outputText>
							<h:outputText value="#{con100.selectDyeItem.lastPostingDate}">
								<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
							</h:outputText>
							<h:outputText value="#{bundle.remark}"/>
							<h:inputText value="#{con100.selectDyeItem.reserveDyeRemark}"/>
							<h:outputText value="Sale Order"/>
							<h:outputText value="#{con100.selectDyeItem.saleData.id.saleOrder}"></h:outputText>
							<h:outputText value="Item"/>
							<h:outputText value="#{con100.selectDyeItem.saleData.id.saleItem}"></h:outputText>
							<h:outputText value="Due Date"/>
							<h:outputText value="#{con100.selectDyeItem.saleData.dueDate}">
								<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
							</h:outputText>
						</h:panelGrid>
					</a4j:outputPanel>
					<a4j:commandButton id="editReservreLineDyeButton" value="Save" reRender="reserveItemDyeTable,editReserveLineDyePanel" 
					onclick="javascript:Richfaces.hideModalPanel('editReserveLineDyePanel');"/>
				</h:form>
			</rich:modalPanel>
			</div> 
			
			<div id="footer">
				<h:form id="footerForm">
					<h:panelGrid columns="2" width="500px" styleClass="normal2">
					<h:panelGroup>
						<h:outputText value="#{bundle.current_user}" styleClass="headerSubject"/>
						<h:outputText value="#{con000.userName}"/>
					</h:panelGroup>
					<h:panelGroup>
					<h:commandLink value="Main Menu" action="con001" styleClass="header2"></h:commandLink>
					<h:outputText value="|"/>
					<h:commandLink value="Logoff" action="#{con000.logoff}" styleClass="header2"></h:commandLink>
					</h:panelGroup>
					</h:panelGrid>
				</h:form> 
			</div>
		</f:view>
		</div>	
	</body>
</html>